<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>${content.title} - ${category.name}</title>
    <meta name="keywords" content="<#list getKeywords(content.title) as a>${a}<#sep>,</#list>"/>
    <meta name="description" content="${content.description}"/>
    <script src="${site.dynamicPath!}resource/js/jquery-1.9.1.min.js"></script>
</head>
<body>
    <header>
        <h1>${(site.name)!}</h1>
    </header>
    <nav>
        <a href="${site.sitePath}">Home page</a>
<@_categoryList>
    <#list page.list as a>
        <a href="${a.url!}" target="_blank">${a.name}</a>
    </#list>
</@_categoryList>
    </nav>
<#if content?has_content>
    <main>
        <article>
            <h1><a href="${content.url!}">${content.title}</a></h1>
            <p><#if content.copied>Source:<a href="${(attribute.sourceUrl)!}" target="_blank">${(attribute.source)!}</a></#if> ${content.author!} ${content.editor!} ${content.publishDate?datetime} Views:<em>loading...</em></p>
            <div>${text?no_esc!}</div>
        <#if content.hasFiles>
            <div>
                <@_contentFileList contentId=content.id fileTypes='video,audio,other'>
                    <#list page.list as file>
                        <a href="${site.sitePath+(file.filePath)!}" target="_blank">${(file.filePath)!}</a>
                    </#list>
                </@_contentFileList>
            </div>
        </#if>
        <#if content.hasImages>
            <div>
             <@_contentFileList contentId=content.id fileTypes='image'>
                 <#list page.list as file>
                     <img src="${site.sitePath+(file.filePath)!}" style="max-width:200px;max-height:200px;border:1px solid;"/>
                 </#list>
             </@_contentFileList>
            </div>
        </#if>
        <#if content.tags?has_content>
            <div>
                Tags:
                <@_tag ids=content.tags>
                    <#list map as key,tag>
                        <em>${tag.name}</em>
                    </#list>
                </@_tag>
            </div>
        </#if>
            <div>
                <@_contentList parentId=content.parentId endPublishDate=content.publishDate pageIndex=2 count=1><#if 2=page.pageIndex><#list page.list as a><a href="${a.url!}">Previous</a></#list></#if></@_contentList>
            </div>
            <div>
                <#if !page.firstPage>
                    <a href="${getPage(url,page.prePage)}">Previous page</a>
                <#else>
                    <span>Previous page</span>
                </#if>
                <#list 1..page.totalCount as n>
                    <#if n=page.pageIndex>
                        ${n}
                    <#else>
                        <a href="${getPage(url,n)}">${n}</a>
                    </#if>
                </#list>
                <#if !page.lastPage>
                    <a href="${getPage(url,page.nextPage)}">Next page</a>
                <#else>
                    <span>Next page</span>
                </#if>
            </div>
            <script>
                $.getJSON('${site.dynamicPath!}api/contentClick?id=${content.id}', function(data){
                    $('article p em').text(data.clicks);
                });
            </script>
        </article>
        <aside>
            <h3>Popular content</h3>
            <ul>
<@_contentList categoryId=category.id containChild=true orderField='clicks' count=10>
    <#list page.list as a>
                <li><a href="<#if a.onlyUrl>${site.dynamicPath}content/redirect.do?id=${a.id}<#else>${a.url!}</#if>" target="_blank">${a.title}</a><span>${a.clicks}</span></li>
    </#list>
</@_contentList>
            </ul>
        </aside>
    </main>
<#else>
    <main>
        <h2>Content does not exist</h2>
    </main>
</#if>
    <footer>
        Copyright &copy; ${.now?string('yyyy')}
    </footer>
</body>
</html>